home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 November / PCWNOV07.iso / Software / Freeware / NSIS 2.29 / nsis-2.29-setup.exe / Include / FileFunc.nsh < prev    next >
Encoding:
Text File  |  2007-06-26  |  44.7 KB  |  2,436 lines

  1. /*
  2. _____________________________________________________________________________
  3.  
  4.                        File Functions Header v3.4
  5. _____________________________________________________________________________
  6.  
  7.  2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
  8.  
  9.  See documentation for more information about the following functions.
  10.  
  11.  Usage in script:
  12.  1. !include "FileFunc.nsh"
  13.  2. !insertmacro FileFunction
  14.  3. [Section|Function]
  15.       ${FileFunction} "Param1" "Param2" "..." $var
  16.     [SectionEnd|FunctionEnd]
  17.  
  18.  
  19.  FileFunction=[Locate|GetSize|DriveSpace|GetDrives|GetTime|GetFileAttributes|
  20.                GetFileVersion|GetExeName|GetExePath|GetParameters|GetOptions|
  21.                GetOptionsS|GetRoot|GetParent|GetFileName|GetBaseName|GetFileExt|
  22.                BannerTrimPath|DirState|RefreshShellIcons]
  23.  
  24.  un.FileFunction=[un.Locate|un.GetSize|un.DriveSpace|un.GetDrives|un.GetTime|
  25.                   un.GetFileAttributes|un.GetFileVersion|un.GetExeName|
  26.                   un.GetExePath|un.GetParameters|un.GetOptions|un.GetOptionsS|
  27.                   un.GetRoot|un.GetParent|un.GetFileName|un.GetBaseName|
  28.                   un.GetFileExt|un.BannerTrimPath|un.DirState|un.RefreshShellIcons]
  29.  
  30. _____________________________________________________________________________
  31.  
  32.                        Thanks to:
  33. _____________________________________________________________________________
  34.  
  35. GetSize
  36.     KiCHiK (Function "FindFiles")
  37. DriveSpace
  38.     sunjammer (Function "CheckSpaceFree")
  39. GetDrives
  40.     deguix (Based on his idea of Function "DetectDrives")
  41. GetTime
  42.     Takhir (Script "StatTest") and deguix (Function "FileModifiedDate")
  43. GetFileVersion
  44.     KiCHiK (Based on his example for command "GetDLLVersion")
  45. GetParameters
  46.     sunjammer (Based on his Function "GetParameters")
  47. GetRoot
  48.     KiCHiK (Based on his Function "GetRoot")
  49. GetParent
  50.     sunjammer (Based on his Function "GetParent")
  51. GetFileName
  52.     KiCHiK (Based on his Function "GetFileName")
  53. GetBaseName
  54.     comperio (Based on his idea of Function "GetBaseName")
  55. GetFileExt
  56.     opher (author)
  57. RefreshShellIcons
  58.     jerome tremblay (author)
  59. */
  60.  
  61.  
  62. ;_____________________________________________________________________________
  63. ;
  64. ;                         Macros
  65. ;_____________________________________________________________________________
  66. ;
  67. ; Change log window verbosity (default: 3=no script)
  68. ;
  69. ; Example:
  70. ; !include "FileFunc.nsh"
  71. ; !insertmacro Locate
  72. ; ${FILEFUNC_VERBOSE} 4   # all verbosity
  73. ; !insertmacro VersionCompare
  74. ; ${FILEFUNC_VERBOSE} 3   # no script
  75.  
  76. !ifndef FILEFUNC_INCLUDED
  77. !define FILEFUNC_INCLUDED
  78.  
  79. !verbose push
  80. !verbose 3
  81. !ifndef _FILEFUNC_VERBOSE
  82.     !define _FILEFUNC_VERBOSE 3
  83. !endif
  84. !verbose ${_FILEFUNC_VERBOSE}
  85. !define FILEFUNC_VERBOSE `!insertmacro FILEFUNC_VERBOSE`
  86. !define _FILEFUNC_UN
  87. !define _FILEFUNC_S
  88. !verbose pop
  89.  
  90. !macro FILEFUNC_VERBOSE _VERBOSE
  91.     !verbose push
  92.     !verbose 3
  93.     !undef _FILEFUNC_VERBOSE
  94.     !define _FILEFUNC_VERBOSE ${_VERBOSE}
  95.     !verbose pop
  96. !macroend
  97.  
  98.  
  99. # Install. Case insensitive. #
  100.  
  101. !macro LocateCall _PATH _OPTIONS _FUNC
  102.     !verbose push
  103.     !verbose ${_FILEFUNC_VERBOSE}
  104.     Push $0
  105.     Push `${_PATH}`
  106.     Push `${_OPTIONS}`
  107.     GetFunctionAddress $0 `${_FUNC}`
  108.     Push `$0`
  109.     Call Locate
  110.     Pop $0
  111.     !verbose pop
  112. !macroend
  113.  
  114. !macro GetSizeCall _PATH _OPTIONS _RESULT1 _RESULT2 _RESULT3
  115.     !verbose push
  116.     !verbose ${_FILEFUNC_VERBOSE}
  117.     Push `${_PATH}`
  118.     Push `${_OPTIONS}`
  119.     Call GetSize
  120.     Pop ${_RESULT1}
  121.     Pop ${_RESULT2}
  122.     Pop ${_RESULT3}
  123.     !verbose pop
  124. !macroend
  125.  
  126. !macro DriveSpaceCall _DRIVE _OPTIONS _RESULT
  127.     !verbose push
  128.     !verbose ${_FILEFUNC_VERBOSE}
  129.     Push `${_DRIVE}`
  130.     Push `${_OPTIONS}`
  131.     Call DriveSpace
  132.     Pop ${_RESULT}
  133.     !verbose pop
  134. !macroend
  135.  
  136. !macro GetDrivesCall _DRV _FUNC
  137.     !verbose push
  138.     !verbose ${_FILEFUNC_VERBOSE}
  139.     Push $0
  140.     Push `${_DRV}`
  141.     GetFunctionAddress $0 `${_FUNC}`
  142.     Push `$0`
  143.     Call GetDrives
  144.     Pop $0
  145.     !verbose pop
  146. !macroend
  147.  
  148. !macro GetTimeCall _FILE _OPTION _RESULT1 _RESULT2 _RESULT3 _RESULT4 _RESULT5 _RESULT6 _RESULT7
  149.     !verbose push
  150.     !verbose ${_FILEFUNC_VERBOSE}
  151.     Push `${_FILE}`
  152.     Push `${_OPTION}`
  153.     Call GetTime
  154.     Pop ${_RESULT1}
  155.     Pop ${_RESULT2}
  156.     Pop ${_RESULT3}
  157.     Pop ${_RESULT4}
  158.     Pop ${_RESULT5}
  159.     Pop ${_RESULT6}
  160.     Pop ${_RESULT7}
  161.     !verbose pop
  162. !macroend
  163.  
  164. !macro GetFileAttributesCall _PATH _ATTR _RESULT
  165.     !verbose push
  166.     !verbose ${_FILEFUNC_VERBOSE}
  167.     Push `${_PATH}`
  168.     Push `${_ATTR}`
  169.     Call GetFileAttributes
  170.     Pop ${_RESULT}
  171.     !verbose pop
  172. !macroend
  173.  
  174. !macro GetFileVersionCall _FILE _RESULT
  175.     !verbose push
  176.     !verbose ${_FILEFUNC_VERBOSE}
  177.     Push `${_FILE}`
  178.     Call GetFileVersion
  179.     Pop ${_RESULT}
  180.     !verbose pop
  181. !macroend
  182.  
  183. !macro GetExeNameCall _RESULT
  184.     !verbose push
  185.     !verbose ${_FILEFUNC_VERBOSE}
  186.     Call GetExeName
  187.     Pop ${_RESULT}
  188.     !verbose pop
  189. !macroend
  190.  
  191. !macro GetExePathCall _RESULT
  192.     !verbose push
  193.     !verbose ${_FILEFUNC_VERBOSE}
  194.     Call GetExePath
  195.     Pop ${_RESULT}
  196.     !verbose pop
  197. !macroend
  198.  
  199. !macro GetParametersCall _RESULT
  200.     !verbose push
  201.     !verbose ${_FILEFUNC_VERBOSE}
  202.     Call GetParameters
  203.     Pop ${_RESULT}
  204.     !verbose pop
  205. !macroend
  206.  
  207. !macro GetOptionsCall _PARAMETERS _OPTION _RESULT
  208.     !verbose push
  209.     !verbose ${_FILEFUNC_VERBOSE}
  210.     Push `${_PARAMETERS}`
  211.     Push `${_OPTION}`
  212.     Call GetOptions
  213.     Pop ${_RESULT}
  214.     !verbose pop
  215. !macroend
  216.  
  217. !macro GetRootCall _FULLPATH _RESULT
  218.     !verbose push
  219.     !verbose ${_FILEFUNC_VERBOSE}
  220.     Push `${_FULLPATH}`
  221.     Call GetRoot
  222.     Pop ${_RESULT}
  223.     !verbose pop
  224. !macroend
  225.  
  226. !macro GetParentCall _PATHSTRING _RESULT
  227.     !verbose push
  228.     !verbose ${_FILEFUNC_VERBOSE}
  229.     Push `${_PATHSTRING}`
  230.     Call GetParent
  231.     Pop ${_RESULT}
  232.     !verbose pop
  233. !macroend
  234.  
  235. !macro GetFileNameCall _PATHSTRING _RESULT
  236.     !verbose push
  237.     !verbose ${_FILEFUNC_VERBOSE}
  238.     Push `${_PATHSTRING}`
  239.     Call GetFileName
  240.     Pop ${_RESULT}
  241.     !verbose pop
  242. !macroend
  243.  
  244. !macro GetBaseNameCall _FILESTRING _RESULT
  245.     !verbose push
  246.     !verbose ${_FILEFUNC_VERBOSE}
  247.     Push `${_FILESTRING}`
  248.     Call GetBaseName
  249.     Pop ${_RESULT}
  250.     !verbose pop
  251. !macroend
  252.  
  253. !macro GetFileExtCall _FILESTRING _RESULT
  254.     !verbose push
  255.     !verbose ${_FILEFUNC_VERBOSE}
  256.     Push `${_FILESTRING}`
  257.     Call GetFileExt
  258.     Pop ${_RESULT}
  259.     !verbose pop
  260. !macroend
  261.  
  262. !macro BannerTrimPathCall _PATH _LENGHT _RESULT
  263.     !verbose push
  264.     !verbose ${_FILEFUNC_VERBOSE}
  265.     Push `${_PATH}`
  266.     Push `${_LENGHT}`
  267.     Call BannerTrimPath
  268.     Pop ${_RESULT}
  269.     !verbose pop
  270. !macroend
  271.  
  272. !macro DirStateCall _PATH _RESULT
  273.     !verbose push
  274.     !verbose ${_FILEFUNC_VERBOSE}
  275.     Push `${_PATH}`
  276.     Call DirState
  277.     Pop ${_RESULT}
  278.     !verbose pop
  279. !macroend
  280.  
  281. !macro RefreshShellIconsCall
  282.     !verbose push
  283.     !verbose ${_FILEFUNC_VERBOSE}
  284.     Call RefreshShellIcons
  285.     !verbose pop
  286. !macroend
  287.  
  288. !macro Locate
  289.     !ifndef ${_FILEFUNC_UN}Locate
  290.         !verbose push
  291.         !verbose ${_FILEFUNC_VERBOSE}
  292.         !define ${_FILEFUNC_UN}Locate `!insertmacro ${_FILEFUNC_UN}LocateCall`
  293.  
  294.         Function ${_FILEFUNC_UN}Locate
  295.             Exch $2
  296.             Exch
  297.             Exch $1
  298.             Exch
  299.             Exch 2
  300.             Exch $0
  301.             Exch 2
  302.             Push $3
  303.             Push $4
  304.             Push $5
  305.             Push $6
  306.             Push $7
  307.             Push $8
  308.             Push $9
  309.             Push $R6
  310.             Push $R7
  311.             Push $R8
  312.             Push $R9
  313.             ClearErrors
  314.  
  315.             StrCpy $3 ''
  316.             StrCpy $4 ''
  317.             StrCpy $5 ''
  318.             StrCpy $6 ''
  319.             StrCpy $7 ''
  320.             StrCpy $8 0
  321.             StrCpy $R7 ''
  322.  
  323.             StrCpy $R9 $0 1 -1
  324.             StrCmp $R9 '\' 0 +3
  325.             StrCpy $0 $0 -1
  326.             goto -3
  327.             IfFileExists '$0\*.*' 0 error
  328.  
  329.             option:
  330.             StrCpy $R9 $1 1
  331.             StrCpy $1 $1 '' 1
  332.             StrCmp $R9 ' ' -2
  333.             StrCmp $R9 '' sizeset
  334.             StrCmp $R9 '/' 0 -4
  335.             StrCpy $9 -1
  336.             IntOp $9 $9 + 1
  337.             StrCpy $R9 $1 1 $9
  338.             StrCmp $R9 '' +2
  339.             StrCmp $R9 '/' 0 -3
  340.             StrCpy $R8 $1 $9
  341.             StrCpy $R8 $R8 '' 2
  342.             StrCpy $R9 $R8 '' -1
  343.             StrCmp $R9 ' ' 0 +3
  344.             StrCpy $R8 $R8 -1
  345.             goto -3
  346.             StrCpy $R9 $1 2
  347.             StrCpy $1 $1 '' $9
  348.  
  349.             StrCmp $R9 'L=' 0 mask
  350.             StrCpy $3 $R8
  351.             StrCmp $3 '' +6
  352.             StrCmp $3 'FD' +5
  353.             StrCmp $3 'F' +4
  354.             StrCmp $3 'D' +3
  355.             StrCmp $3 'DE' +2
  356.             StrCmp $3 'FDE' 0 error
  357.             goto option
  358.  
  359.             mask:
  360.             StrCmp $R9 'M=' 0 size
  361.             StrCpy $4 $R8
  362.             goto option
  363.  
  364.             size:
  365.             StrCmp $R9 'S=' 0 gotosubdir
  366.             StrCpy $6 $R8
  367.             goto option
  368.  
  369.             gotosubdir:
  370.             StrCmp $R9 'G=' 0 banner
  371.             StrCpy $7 $R8
  372.             StrCmp $7 '' +3
  373.             StrCmp $7 '1' +2
  374.             StrCmp $7 '0' 0 error
  375.             goto option
  376.  
  377.             banner:
  378.             StrCmp $R9 'B=' 0 error
  379.             StrCpy $R7 $R8
  380.             StrCmp $R7 '' +3
  381.             StrCmp $R7 '1' +2
  382.             StrCmp $R7 '0' 0 error
  383.             goto option
  384.  
  385.             sizeset:
  386.             StrCmp $6 '' default
  387.             StrCpy $9 0
  388.             StrCpy $R9 $6 1 $9
  389.             StrCmp $R9 '' +4
  390.             StrCmp $R9 ':' +3
  391.             IntOp $9 $9 + 1
  392.             goto -4
  393.             StrCpy $5 $6 $9
  394.             IntOp $9 $9 + 1
  395.             StrCpy $1 $6 1 -1
  396.             StrCpy $6 $6 -1 $9
  397.             StrCmp $5 '' +2
  398.             IntOp $5 $5 + 0
  399.             StrCmp $6 '' +2
  400.             IntOp $6 $6 + 0
  401.  
  402.             StrCmp $1 'B' 0 +3
  403.             StrCpy $1 1
  404.             goto default
  405.             StrCmp $1 'K' 0 +3
  406.             StrCpy $1 1024
  407.             goto default
  408.             StrCmp $1 'M' 0 +3
  409.             StrCpy $1 1048576
  410.             goto default
  411.             StrCmp $1 'G' 0 error
  412.             StrCpy $1 1073741824
  413.  
  414.             default:
  415.             StrCmp $3 '' 0 +2
  416.             StrCpy $3 'FD'
  417.             StrCmp $4 '' 0 +2
  418.             StrCpy $4 '*.*'
  419.             StrCmp $7 '' 0 +2
  420.             StrCpy $7 '1'
  421.             StrCmp $R7 '' 0 +2
  422.             StrCpy $R7 '0'
  423.             StrCpy $7 'G$7B$R7'
  424.  
  425.             StrCpy $8 1
  426.             Push $0
  427.             SetDetailsPrint textonly
  428.  
  429.             nextdir:
  430.             IntOp $8 $8 - 1
  431.             Pop $R8
  432.  
  433.             StrCpy $9 $7 2 2
  434.             StrCmp $9 'B0' +3
  435.             GetLabelAddress $9 findfirst
  436.             goto call
  437.             DetailPrint 'Search in: $R8'
  438.  
  439.             findfirst:
  440.             FindFirst $0 $R7 '$R8\$4'
  441.             IfErrors subdir
  442.             StrCmp $R7 '.' 0 dir
  443.             FindNext $0 $R7
  444.             StrCmp $R7 '..' 0 dir
  445.             FindNext $0 $R7
  446.             IfErrors 0 dir
  447.             FindClose $0
  448.             goto subdir
  449.  
  450.             dir:
  451.             IfFileExists '$R8\$R7\*.*' 0 file
  452.             StrCpy $R6 ''
  453.             StrCmp $3 'DE' +4
  454.             StrCmp $3 'FDE' +3
  455.             StrCmp $3 'FD' precall
  456.             StrCmp $3 'F' findnext precall
  457.             FindFirst $9 $R9 '$R8\$R7\*.*'
  458.             StrCmp $R9 '.' 0 +4
  459.             FindNext $9 $R9
  460.             StrCmp $R9 '..' 0 +2
  461.             FindNext $9 $R9
  462.             FindClose $9
  463.             IfErrors precall findnext
  464.  
  465.             file:
  466.             StrCmp $3 'FDE' +3
  467.             StrCmp $3 'FD' +2
  468.             StrCmp $3 'F' 0 findnext
  469.             StrCpy $R6 0
  470.             StrCmp $5$6 '' precall
  471.             FileOpen $9 '$R8\$R7' r
  472.             IfErrors +3
  473.             FileSeek $9 0 END $R6
  474.             FileClose $9
  475.             System::Int64Op $R6 / $1
  476.             Pop $R6
  477.             StrCmp $5 '' +2
  478.             IntCmp $R6 $5 0 findnext
  479.             StrCmp $6 '' +2
  480.             IntCmp $R6 $6 0 0 findnext
  481.  
  482.             precall:
  483.             StrCpy $9 0
  484.             StrCpy $R9 '$R8\$R7'
  485.  
  486.             call:
  487.             Push $0
  488.             Push $1
  489.             Push $2
  490.             Push $3
  491.             Push $4
  492.             Push $5
  493.             Push $6
  494.             Push $7
  495.             Push $8
  496.             Push $9
  497.             Push $R7
  498.             Push $R8
  499.             StrCmp $9 0 +4
  500.             StrCpy $R6 ''
  501.             StrCpy $R7 ''
  502.             StrCpy $R9 ''
  503.             Call $2
  504.             Pop $R9
  505.             Pop $R8
  506.             Pop $R7
  507.             Pop $9
  508.             Pop $8
  509.             Pop $7
  510.             Pop $6
  511.             Pop $5
  512.             Pop $4
  513.             Pop $3
  514.             Pop $2
  515.             Pop $1
  516.             Pop $0
  517.  
  518.             IfErrors 0 +3
  519.             FindClose $0
  520.             goto error
  521.             StrCmp $R9 'StopLocate' 0 +3
  522.             FindClose $0
  523.             goto clearstack
  524.             goto $9
  525.  
  526.             findnext:
  527.             FindNext $0 $R7
  528.             IfErrors 0 dir
  529.             FindClose $0
  530.  
  531.             subdir:
  532.             StrCpy $9 $7 2
  533.             StrCmp $9 'G0' end
  534.             FindFirst $0 $R7 '$R8\*.*'
  535.             StrCmp $R7 '.' 0 pushdir
  536.             FindNext $0 $R7
  537.             StrCmp $R7 '..' 0 pushdir
  538.             FindNext $0 $R7
  539.             IfErrors 0 pushdir
  540.             FindClose $0
  541.             StrCmp $8 0 end nextdir
  542.  
  543.             pushdir:
  544.             IfFileExists '$R8\$R7\*.*' 0 +3
  545.             Push '$R8\$R7'
  546.             IntOp $8 $8 + 1
  547.             FindNext $0 $R7
  548.             IfErrors 0 pushdir
  549.             FindClose $0
  550.             StrCmp $8 0 end nextdir
  551.  
  552.             error:
  553.             SetErrors
  554.  
  555.             clearstack:
  556.             StrCmp $8 0 end
  557.             IntOp $8 $8 - 1
  558.             Pop $R8
  559.             goto clearstack
  560.  
  561.             end:
  562.             SetDetailsPrint both
  563.             Pop $R9
  564.             Pop $R8
  565.             Pop $R7
  566.             Pop $R6
  567.             Pop $9
  568.             Pop $8
  569.             Pop $7
  570.             Pop $6
  571.             Pop $5
  572.             Pop $4
  573.             Pop $3
  574.             Pop $2
  575.             Pop $1
  576.             Pop $0
  577.         FunctionEnd
  578.  
  579.         !verbose pop
  580.     !endif
  581. !macroend
  582.  
  583. !macro GetSize
  584.     !ifndef ${_FILEFUNC_UN}GetSize
  585.         !verbose push
  586.         !verbose ${_FILEFUNC_VERBOSE}
  587.         !define ${_FILEFUNC_UN}GetSize `!insertmacro ${_FILEFUNC_UN}GetSizeCall`
  588.  
  589.         Function ${_FILEFUNC_UN}GetSize
  590.             Exch $1
  591.             Exch
  592.             Exch $0
  593.             Exch
  594.             Push $2
  595.             Push $3
  596.             Push $4
  597.             Push $5
  598.             Push $6
  599.             Push $7
  600.             Push $8
  601.             Push $9
  602.             Push $R3
  603.             Push $R4
  604.             Push $R5
  605.             Push $R6
  606.             Push $R7
  607.             Push $R8
  608.             Push $R9
  609.             ClearErrors
  610.  
  611.             StrCpy $R9 $0 1 -1
  612.             StrCmp $R9 '\' 0 +3
  613.             StrCpy $0 $0 -1
  614.             goto -3
  615.             IfFileExists '$0\*.*' 0 error
  616.  
  617.             StrCpy $3 ''
  618.             StrCpy $4 ''
  619.             StrCpy $5 ''
  620.             StrCpy $6 ''
  621.             StrCpy $8 0
  622.             StrCpy $R3 ''
  623.             StrCpy $R4 ''
  624.             StrCpy $R5 ''
  625.  
  626.             option:
  627.             StrCpy $R9 $1 1
  628.             StrCpy $1 $1 '' 1
  629.             StrCmp $R9 ' ' -2
  630.             StrCmp $R9 '' sizeset
  631.             StrCmp $R9 '/' 0 -4
  632.  
  633.             StrCpy $9 -1
  634.             IntOp $9 $9 + 1
  635.             StrCpy $R9 $1 1 $9
  636.             StrCmp $R9 '' +2
  637.             StrCmp $R9 '/' 0 -3
  638.             StrCpy $8 $1 $9
  639.             StrCpy $8 $8 '' 2
  640.             StrCpy $R9 $8 '' -1
  641.             StrCmp $R9 ' ' 0 +3
  642.             StrCpy $8 $8 -1
  643.             goto -3
  644.             StrCpy $R9 $1 2
  645.             StrCpy $1 $1 '' $9
  646.  
  647.             StrCmp $R9 'M=' 0 size
  648.             StrCpy $4 $8
  649.             goto option
  650.  
  651.             size:
  652.             StrCmp $R9 'S=' 0 gotosubdir
  653.             StrCpy $6 $8
  654.             goto option
  655.  
  656.             gotosubdir:
  657.             StrCmp $R9 'G=' 0 error
  658.             StrCpy $7 $8
  659.             StrCmp $7 '' +3
  660.             StrCmp $7 '1' +2
  661.             StrCmp $7 '0' 0 error
  662.             goto option
  663.  
  664.             sizeset:
  665.             StrCmp $6 '' default
  666.             StrCpy $9 0
  667.             StrCpy $R9 $6 1 $9
  668.             StrCmp $R9 '' +4
  669.             StrCmp $R9 ':' +3
  670.             IntOp $9 $9 + 1
  671.             goto -4
  672.             StrCpy $5 $6 $9
  673.             IntOp $9 $9 + 1
  674.             StrCpy $1 $6 1 -1
  675.             StrCpy $6 $6 -1 $9
  676.             StrCmp $5 '' +2
  677.             IntOp $5 $5 + 0
  678.             StrCmp $6 '' +2
  679.             IntOp $6 $6 + 0
  680.  
  681.             StrCmp $1 'B' 0 +4
  682.             StrCpy $1 1
  683.             StrCpy $2 bytes
  684.             goto default
  685.             StrCmp $1 'K' 0 +4
  686.             StrCpy $1 1024
  687.             StrCpy $2 Kb
  688.             goto default
  689.             StrCmp $1 'M' 0 +4
  690.             StrCpy $1 1048576
  691.             StrCpy $2 Mb
  692.             goto default
  693.             StrCmp $1 'G' 0 error
  694.             StrCpy $1 1073741824
  695.             StrCpy $2 Gb
  696.  
  697.             default:
  698.             StrCmp $4 '' 0 +2
  699.             StrCpy $4 '*.*'
  700.             StrCmp $7 '' 0 +2
  701.             StrCpy $7 '1'
  702.  
  703.             StrCpy $8 1
  704.             Push $0
  705.             SetDetailsPrint textonly
  706.  
  707.             nextdir:
  708.             IntOp $8 $8 - 1
  709.             Pop $R8
  710.             FindFirst $0 $R7 '$R8\$4'
  711.             IfErrors show
  712.             StrCmp $R7 '.' 0 dir
  713.             FindNext $0 $R7
  714.             StrCmp $R7 '..' 0 dir
  715.             FindNext $0 $R7
  716.             IfErrors 0 dir
  717.             FindClose $0
  718.             goto show
  719.  
  720.             dir:
  721.             IfFileExists '$R8\$R7\*.*' 0 file
  722.             IntOp $R5 $R5 + 1
  723.             goto findnext
  724.  
  725.             file:
  726.             StrCpy $R6 0
  727.             StrCmp $5$6 '' 0 +3
  728.             IntOp $R4 $R4 + 1
  729.             goto findnext
  730.             FileOpen $9 '$R8\$R7' r
  731.             IfErrors +3
  732.             FileSeek $9 0 END $R6
  733.             FileClose $9
  734.             StrCmp $5 '' +2
  735.             IntCmp $R6 $5 0 findnext
  736.             StrCmp $6 '' +2
  737.             IntCmp $R6 $6 0 0 findnext
  738.             IntOp $R4 $R4 + 1
  739.             System::Int64Op /NOUNLOAD $R3 + $R6
  740.             Pop $R3
  741.  
  742.             findnext:
  743.             FindNext $0 $R7
  744.             IfErrors 0 dir
  745.             FindClose $0
  746.  
  747.             show:
  748.             StrCmp $5$6 '' nosize
  749.             System::Int64Op /NOUNLOAD $R3 / $1
  750.             Pop $9
  751.             DetailPrint 'Size:$9 $2  Files:$R4  Folders:$R5'
  752.             goto subdir
  753.             nosize:
  754.             DetailPrint 'Files:$R4  Folders:$R5'
  755.  
  756.             subdir:
  757.             StrCmp $7 0 preend
  758.             FindFirst $0 $R7 '$R8\*.*'
  759.             StrCmp $R7 '.' 0 pushdir
  760.             FindNext $0 $R7
  761.             StrCmp $R7 '..' 0 pushdir
  762.             FindNext $0 $R7
  763.             IfErrors 0 pushdir
  764.             FindClose $0
  765.             StrCmp $8 0 preend nextdir
  766.  
  767.             pushdir:
  768.             IfFileExists '$R8\$R7\*.*' 0 +3
  769.             Push '$R8\$R7'
  770.             IntOp $8 $8 + 1
  771.             FindNext $0 $R7
  772.             IfErrors 0 pushdir
  773.             FindClose $0
  774.             StrCmp $8 0 preend nextdir
  775.  
  776.             preend:
  777.             StrCmp $R3 '' nosizeend
  778.             System::Int64Op $R3 / $1
  779.             Pop $R3
  780.             nosizeend:
  781.             StrCpy $2 $R4
  782.             StrCpy $1 $R5
  783.             StrCpy $0 $R3
  784.             goto end
  785.  
  786.             error:
  787.             SetErrors
  788.             StrCpy $0 ''
  789.             StrCpy $1 ''
  790.             StrCpy $2 ''
  791.  
  792.             end:
  793.             SetDetailsPrint both
  794.             Pop $R9
  795.             Pop $R8
  796.             Pop $R7
  797.             Pop $R6
  798.             Pop $R5
  799.             Pop $R4
  800.             Pop $R3
  801.             Pop $9
  802.             Pop $8
  803.             Pop $7
  804.             Pop $6
  805.             Pop $5
  806.             Pop $4
  807.             Pop $3
  808.             Exch $2
  809.             Exch
  810.             Exch $1
  811.             Exch 2
  812.             Exch $0
  813.         FunctionEnd
  814.  
  815.         !verbose pop
  816.     !endif
  817. !macroend
  818.  
  819. !macro DriveSpace
  820.     !ifndef ${_FILEFUNC_UN}DriveSpace
  821.         !verbose push
  822.         !verbose ${_FILEFUNC_VERBOSE}
  823.         !define ${_FILEFUNC_UN}DriveSpace `!insertmacro ${_FILEFUNC_UN}DriveSpaceCall`
  824.  
  825.         Function ${_FILEFUNC_UN}DriveSpace
  826.             Exch $1
  827.             Exch
  828.             Exch $0
  829.             Exch
  830.             Push $2
  831.             Push $3
  832.             Push $4
  833.             Push $5
  834.             Push $6
  835.             ClearErrors
  836.  
  837.             StrCpy $2 $0 1 -1
  838.             StrCmp $2 '\' 0 +3
  839.             StrCpy $0 $0 -1
  840.             goto -3
  841.             IfFileExists '$0\NUL' 0 error
  842.  
  843.             StrCpy $5 ''
  844.             StrCpy $6 ''
  845.  
  846.             option:
  847.             StrCpy $2 $1 1
  848.             StrCpy $1 $1 '' 1
  849.             StrCmp $2 ' ' -2
  850.             StrCmp $2 '' default
  851.             StrCmp $2 '/' 0 -4
  852.             StrCpy $3 -1
  853.             IntOp $3 $3 + 1
  854.             StrCpy $2 $1 1 $3
  855.             StrCmp $2 '' +2
  856.             StrCmp $2 '/' 0 -3
  857.             StrCpy $4 $1 $3
  858.             StrCpy $4 $4 '' 2
  859.             StrCpy $2 $4 1 -1
  860.             StrCmp $2 ' ' 0 +3
  861.             StrCpy $4 $4 -1
  862.             goto -3
  863.             StrCpy $2 $1 2
  864.             StrCpy $1 $1 '' $3
  865.  
  866.             StrCmp $2 'D=' 0 unit
  867.             StrCpy $5 $4
  868.             StrCmp $5 '' +4
  869.             StrCmp $5 'T' +3
  870.             StrCmp $5 'O' +2
  871.             StrCmp $5 'F' 0 error
  872.             goto option
  873.  
  874.             unit:
  875.             StrCmp $2 'S=' 0 error
  876.             StrCpy $6 $4
  877.             goto option
  878.  
  879.             default:
  880.             StrCmp $5 '' 0 +2
  881.             StrCpy $5 'T'
  882.             StrCmp $6 '' 0 +3
  883.             StrCpy $6 '1'
  884.             goto getspace
  885.  
  886.             StrCmp $6 'B' 0 +3
  887.             StrCpy $6 1
  888.             goto getspace
  889.             StrCmp $6 'K' 0 +3
  890.             StrCpy $6 1024
  891.             goto getspace
  892.             StrCmp $6 'M' 0 +3
  893.             StrCpy $6 1048576
  894.             goto getspace
  895.             StrCmp $6 'G' 0 error
  896.             StrCpy $6 1073741824
  897.  
  898.             getspace:
  899.             System::Call /NOUNLOAD 'kernel32::GetDiskFreeSpaceExA(t, *l, *l, *l)i(r0,.r2,.r3,.)'
  900.  
  901.             StrCmp $5 T 0 +3
  902.             StrCpy $0 $3
  903.             goto getsize
  904.             StrCmp $5 O 0 +4
  905.             System::Int64Op /NOUNLOAD $3 - $2
  906.             Pop $0
  907.             goto getsize
  908.             StrCmp $5 F 0 +2
  909.             StrCpy $0 $2
  910.  
  911.             getsize:
  912.             System::Int64Op $0 / $6
  913.             Pop $0
  914.             goto end
  915.  
  916.             error:
  917.             SetErrors
  918.             StrCpy $0 ''
  919.  
  920.             end:
  921.             Pop $6
  922.             Pop $5
  923.             Pop $4
  924.             Pop $3
  925.             Pop $2
  926.             Pop $1
  927.             Exch $0
  928.         FunctionEnd
  929.  
  930.         !verbose pop
  931.     !endif
  932. !macroend
  933.  
  934. !macro GetDrives
  935.     !ifndef ${_FILEFUNC_UN}GetDrives
  936.         !verbose push
  937.         !verbose ${_FILEFUNC_VERBOSE}
  938.         !define ${_FILEFUNC_UN}GetDrives `!insertmacro ${_FILEFUNC_UN}GetDrivesCall`
  939.  
  940.         Function ${_FILEFUNC_UN}GetDrives
  941.             Exch $1
  942.             Exch
  943.             Exch $0
  944.             Exch
  945.             Push $2
  946.             Push $3
  947.             Push $4
  948.             Push $5
  949.             Push $6
  950.             Push $8
  951.             Push $9
  952.  
  953.             System::Alloc /NOUNLOAD 1024
  954.             Pop $2
  955.             System::Call /NOUNLOAD 'kernel32::GetLogicalDriveStringsA(i,i) i(1024, r2)'
  956.  
  957.             StrCmp $0 ALL drivestring
  958.             StrCmp $0 '' 0 typeset
  959.             StrCpy $0 ALL
  960.             goto drivestring
  961.  
  962.             typeset:
  963.             StrCpy $6 -1
  964.             IntOp $6 $6 + 1
  965.             StrCpy $8 $0 1 $6
  966.             StrCmp $8$0 '' enumex
  967.             StrCmp $8 '' +2
  968.             StrCmp $8 '+' 0 -4
  969.             StrCpy $8 $0 $6
  970.             IntOp $6 $6 + 1
  971.             StrCpy $0 $0 '' $6
  972.  
  973.             StrCmp $8 'FDD' 0 +3
  974.             StrCpy $6 2
  975.             goto drivestring
  976.             StrCmp $8 'HDD' 0 +3
  977.             StrCpy $6 3
  978.             goto drivestring
  979.             StrCmp $8 'NET' 0 +3
  980.             StrCpy $6 4
  981.             goto drivestring
  982.             StrCmp $8 'CDROM' 0 +3
  983.             StrCpy $6 5
  984.             goto drivestring
  985.             StrCmp $8 'RAM' 0 typeset
  986.             StrCpy $6 6
  987.  
  988.             drivestring:
  989.             StrCpy $3 $2
  990.  
  991.             enumok:
  992.             System::Call /NOUNLOAD 'kernel32::lstrlenA(t) i(i r3) .r4'
  993.             StrCmp $4$0 '0ALL' enumex
  994.             StrCmp $4 0 typeset
  995.             System::Call /NOUNLOAD 'kernel32::GetDriveTypeA(t) i(i r3) .r5'
  996.  
  997.             StrCmp $0 ALL +2
  998.             StrCmp $5 $6 letter enumnext
  999.             StrCmp $5 2 0 +3
  1000.             StrCpy $8 FDD
  1001.             goto letter
  1002.             StrCmp $5 3 0 +3
  1003.             StrCpy $8 HDD
  1004.             goto letter
  1005.             StrCmp $5 4 0 +3
  1006.             StrCpy $8 NET
  1007.             goto letter
  1008.             StrCmp $5 5 0 +3
  1009.             StrCpy $8 CDROM
  1010.             goto letter
  1011.             StrCmp $5 6 0 enumex
  1012.             StrCpy $8 RAM
  1013.  
  1014.             letter:
  1015.             System::Call /NOUNLOAD '*$3(&t1024 .r9)'
  1016.  
  1017.             Push $0
  1018.             Push $1
  1019.             Push $2
  1020.             Push $3
  1021.             Push $4
  1022.             Push $5
  1023.             Push $6
  1024.             Push $8
  1025.             Call $1
  1026.             Pop $9
  1027.             Pop $8
  1028.             Pop $6
  1029.             Pop $5
  1030.             Pop $4
  1031.             Pop $3
  1032.             Pop $2
  1033.             Pop $1
  1034.             Pop $0
  1035.             StrCmp $9 'StopGetDrives' enumex
  1036.  
  1037.             enumnext:
  1038.             IntOp $3 $3 + $4
  1039.             IntOp $3 $3 + 1
  1040.             goto enumok
  1041.  
  1042.             enumex:
  1043.             System::Free $2
  1044.  
  1045.             Pop $9
  1046.             Pop $8
  1047.             Pop $6
  1048.             Pop $5
  1049.             Pop $4
  1050.             Pop $3
  1051.             Pop $2
  1052.             Pop $1
  1053.             Pop $0
  1054.         FunctionEnd
  1055.  
  1056.         !verbose pop
  1057.     !endif
  1058. !macroend
  1059.  
  1060. !macro GetTime
  1061.     !ifndef ${_FILEFUNC_UN}GetTime
  1062.         !verbose push
  1063.         !verbose ${_FILEFUNC_VERBOSE}
  1064.         !define ${_FILEFUNC_UN}GetTime `!insertmacro ${_FILEFUNC_UN}GetTimeCall`
  1065.  
  1066.         Function ${_FILEFUNC_UN}GetTime
  1067.             Exch $1
  1068.             Exch
  1069.             Exch $0
  1070.             Exch
  1071.             Push $2
  1072.             Push $3
  1073.             Push $4
  1074.             Push $5
  1075.             Push $6
  1076.             Push $7
  1077.             ClearErrors
  1078.  
  1079.             StrCmp $1 'L' gettime
  1080.             StrCmp $1 'A' getfile
  1081.             StrCmp $1 'C' getfile
  1082.             StrCmp $1 'M' getfile
  1083.             StrCmp $1 'LS' gettime
  1084.             StrCmp $1 'AS' getfile
  1085.             StrCmp $1 'CS' getfile
  1086.             StrCmp $1 'MS' getfile
  1087.             goto error
  1088.  
  1089.             getfile:
  1090.             IfFileExists $0 0 error
  1091.             System::Call /NOUNLOAD '*(i,l,l,l,i,i,i,i,&t260,&t14) i .r6'
  1092.             System::Call /NOUNLOAD 'kernel32::FindFirstFileA(t,i)i(r0,r6) .r2'
  1093.             System::Call /NOUNLOAD 'kernel32::FindClose(i)i(r2)'
  1094.  
  1095.             gettime:
  1096.             System::Call /NOUNLOAD '*(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2) i .r7'
  1097.             StrCmp $1 'L' 0 systemtime
  1098.             System::Call /NOUNLOAD 'kernel32::GetLocalTime(i)i(r7)'
  1099.             goto convert
  1100.             systemtime:
  1101.             StrCmp $1 'LS' 0 filetime
  1102.             System::Call /NOUNLOAD 'kernel32::GetSystemTime(i)i(r7)'
  1103.             goto convert
  1104.  
  1105.             filetime:
  1106.             System::Call /NOUNLOAD '*$6(i,l,l,l,i,i,i,i,&t260,&t14)i(,.r4,.r3,.r2)'
  1107.             System::Free /NOUNLOAD $6
  1108.             StrCmp $1 'A' 0 +3
  1109.             StrCpy $2 $3
  1110.             goto tolocal
  1111.             StrCmp $1 'C' 0 +3
  1112.             StrCpy $2 $4
  1113.             goto tolocal
  1114.             StrCmp $1 'M' tolocal
  1115.  
  1116.             StrCmp $1 'AS' tosystem
  1117.             StrCmp $1 'CS' 0 +3
  1118.             StrCpy $3 $4
  1119.             goto tosystem
  1120.             StrCmp $1 'MS' 0 +3
  1121.             StrCpy $3 $2
  1122.             goto tosystem
  1123.  
  1124.             tolocal:
  1125.             System::Call /NOUNLOAD 'kernel32::FileTimeToLocalFileTime(*l,*l)i(r2,.r3)'
  1126.             tosystem:
  1127.             System::Call /NOUNLOAD 'kernel32::FileTimeToSystemTime(*l,i)i(r3,r7)'
  1128.  
  1129.             convert:
  1130.             System::Call /NOUNLOAD '*$7(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2)i(.r5,.r6,.r4,.r0,.r3,.r2,.r1,)'
  1131.             System::Free $7
  1132.  
  1133.             IntCmp $0 9 0 0 +2
  1134.             StrCpy $0 '0$0'
  1135.             IntCmp $1 9 0 0 +2
  1136.             StrCpy $1 '0$1'
  1137.             IntCmp $2 9 0 0 +2
  1138.             StrCpy $2 '0$2'
  1139.             IntCmp $6 9 0 0 +2
  1140.             StrCpy $6 '0$6'
  1141.  
  1142.             StrCmp $4 0 0 +3
  1143.             StrCpy $4 Sunday
  1144.             goto end
  1145.             StrCmp $4 1 0 +3
  1146.             StrCpy $4 Monday
  1147.             goto end
  1148.             StrCmp $4 2 0 +3
  1149.             StrCpy $4 Tuesday
  1150.             goto end
  1151.             StrCmp $4 3 0 +3
  1152.             StrCpy $4 Wednesday
  1153.             goto end
  1154.             StrCmp $4 4 0 +3
  1155.             StrCpy $4 Thursday
  1156.             goto end
  1157.             StrCmp $4 5 0 +3
  1158.             StrCpy $4 Friday
  1159.             goto end
  1160.             StrCmp $4 6 0 error
  1161.             StrCpy $4 Saturday
  1162.             goto end
  1163.  
  1164.             error:
  1165.             SetErrors
  1166.             StrCpy $0 ''
  1167.             StrCpy $1 ''
  1168.             StrCpy $2 ''
  1169.             StrCpy $3 ''
  1170.             StrCpy $4 ''
  1171.             StrCpy $5 ''
  1172.             StrCpy $6 ''
  1173.  
  1174.             end:
  1175.             Pop $7
  1176.             Exch $6
  1177.             Exch
  1178.             Exch $5
  1179.             Exch 2
  1180.             Exch $4
  1181.             Exch 3
  1182.             Exch $3
  1183.             Exch 4
  1184.             Exch $2
  1185.             Exch 5
  1186.             Exch $1
  1187.             Exch 6
  1188.             Exch $0
  1189.         FunctionEnd
  1190.  
  1191.         !verbose pop
  1192.     !endif
  1193. !macroend
  1194.  
  1195. !macro GetFileAttributes
  1196.     !ifndef ${_FILEFUNC_UN}GetFileAttributes
  1197.         !verbose push
  1198.         !verbose ${_FILEFUNC_VERBOSE}
  1199.         !define ${_FILEFUNC_UN}GetFileAttributes `!insertmacro ${_FILEFUNC_UN}GetFileAttributesCall`
  1200.  
  1201.         Function ${_FILEFUNC_UN}GetFileAttributes
  1202.             Exch $1
  1203.             Exch
  1204.             Exch $0
  1205.             Exch
  1206.             Push $2
  1207.             Push $3
  1208.             Push $4
  1209.             Push $5
  1210.  
  1211.             System::Call 'kernel32::GetFileAttributes(t r0)i .r2'
  1212.             StrCmp $2 -1 error
  1213.             StrCpy $3 ''
  1214.  
  1215.             IntOp $0 $2 & 0x4000
  1216.             IntCmp $0 0 +2
  1217.             StrCpy $3 'ENCRYPTED|'
  1218.  
  1219.             IntOp $0 $2 & 0x2000
  1220.             IntCmp $0 0 +2
  1221.             StrCpy $3 'NOT_CONTENT_INDEXED|$3'
  1222.  
  1223.             IntOp $0 $2 & 0x1000
  1224.             IntCmp $0 0 +2
  1225.             StrCpy $3 'OFFLINE|$3'
  1226.  
  1227.             IntOp $0 $2 & 0x0800
  1228.             IntCmp $0 0 +2
  1229.             StrCpy $3 'COMPRESSED|$3'
  1230.  
  1231.             IntOp $0 $2 & 0x0400
  1232.             IntCmp $0 0 +2
  1233.             StrCpy $3 'REPARSE_POINT|$3'
  1234.  
  1235.             IntOp $0 $2 & 0x0200
  1236.             IntCmp $0 0 +2
  1237.             StrCpy $3 'SPARSE_FILE|$3'
  1238.  
  1239.             IntOp $0 $2 & 0x0100
  1240.             IntCmp $0 0 +2
  1241.             StrCpy $3 'TEMPORARY|$3'
  1242.  
  1243.             IntOp $0 $2 & 0x0080
  1244.             IntCmp $0 0 +2
  1245.             StrCpy $3 'NORMAL|$3'
  1246.  
  1247.             IntOp $0 $2 & 0x0040
  1248.             IntCmp $0 0 +2
  1249.             StrCpy $3 'DEVICE|$3'
  1250.  
  1251.             IntOp $0 $2 & 0x0020
  1252.             IntCmp $0 0 +2
  1253.             StrCpy $3 'ARCHIVE|$3'
  1254.  
  1255.             IntOp $0 $2 & 0x0010
  1256.             IntCmp $0 0 +2
  1257.             StrCpy $3 'DIRECTORY|$3'
  1258.  
  1259.             IntOp $0 $2 & 0x0004
  1260.             IntCmp $0 0 +2
  1261.             StrCpy $3 'SYSTEM|$3'
  1262.  
  1263.             IntOp $0 $2 & 0x0002
  1264.             IntCmp $0 0 +2
  1265.             StrCpy $3 'HIDDEN|$3'
  1266.  
  1267.             IntOp $0 $2 & 0x0001
  1268.             IntCmp $0 0 +2
  1269.             StrCpy $3 'READONLY|$3'
  1270.  
  1271.             StrCpy $0 $3 -1
  1272.             StrCmp $1 '' end
  1273.             StrCmp $1 'ALL' end
  1274.  
  1275.             attrcmp:
  1276.             StrCpy $5 0
  1277.             IntOp $5 $5 + 1
  1278.             StrCpy $4 $1 1 $5
  1279.             StrCmp $4 '' +2
  1280.             StrCmp $4 '|'  0 -3
  1281.             StrCpy $2 $1 $5
  1282.             IntOp $5 $5 + 1
  1283.             StrCpy $1 $1 '' $5
  1284.             StrLen $3 $2
  1285.             StrCpy $5 -1
  1286.             IntOp $5 $5 + 1
  1287.             StrCpy $4 $0 $3 $5
  1288.             StrCmp $4 '' notfound
  1289.             StrCmp $4 $2 0 -3
  1290.             StrCmp $1 '' 0 attrcmp
  1291.             StrCpy $0 1
  1292.             goto end
  1293.  
  1294.             notfound:
  1295.             StrCpy $0 0
  1296.             goto end
  1297.  
  1298.             error:
  1299.             SetErrors
  1300.             StrCpy $0 ''
  1301.  
  1302.             end:
  1303.             Pop $5
  1304.             Pop $4
  1305.             Pop $3
  1306.             Pop $2
  1307.             Pop $1
  1308.             Exch $0
  1309.         FunctionEnd
  1310.  
  1311.         !verbose pop
  1312.     !endif
  1313. !macroend
  1314.  
  1315. !macro GetFileVersion
  1316.     !ifndef ${_FILEFUNC_UN}GetFileVersion
  1317.         !verbose push
  1318.         !verbose ${_FILEFUNC_VERBOSE}
  1319.         !define ${_FILEFUNC_UN}GetFileVersion `!insertmacro ${_FILEFUNC_UN}GetFileVersionCall`
  1320.  
  1321.         Function ${_FILEFUNC_UN}GetFileVersion
  1322.             Exch $0
  1323.             Push $1
  1324.             Push $2
  1325.             Push $3
  1326.             Push $4
  1327.             Push $5
  1328.             Push $6
  1329.             ClearErrors
  1330.  
  1331.             GetDllVersion '$0' $1 $2
  1332.             IfErrors error
  1333.             IntOp $3 $1 >> 16
  1334.             IntOp $3 $3 & 0x0000FFFF
  1335.             IntOp $4 $1 & 0x0000FFFF
  1336.             IntOp $5 $2 >> 16
  1337.             IntOp $5 $5 & 0x0000FFFF
  1338.             IntOp $6 $2 & 0x0000FFFF
  1339.             StrCpy $0 '$3.$4.$5.$6'
  1340.             goto end
  1341.  
  1342.             error:
  1343.             SetErrors
  1344.             StrCpy $0 ''
  1345.  
  1346.             end:
  1347.             Pop $6
  1348.             Pop $5
  1349.             Pop $4
  1350.             Pop $3
  1351.             Pop $2
  1352.             Pop $1
  1353.             Exch $0
  1354.         FunctionEnd
  1355.  
  1356.         !verbose pop
  1357.     !endif
  1358. !macroend
  1359.  
  1360. !macro GetExeName
  1361.     !ifndef ${_FILEFUNC_UN}GetExeName
  1362.         !verbose push
  1363.         !verbose ${_FILEFUNC_VERBOSE}
  1364.         !define ${_FILEFUNC_UN}GetExeName `!insertmacro ${_FILEFUNC_UN}GetExeNameCall`
  1365.  
  1366.         Function ${_FILEFUNC_UN}GetExeName
  1367.             Push $0
  1368.             Push $1
  1369.             Push $2
  1370.             System::Call /NOUNLOAD 'kernel32::GetModuleFileNameA(i 0, t .r0, i 1024)'
  1371.             System::Call 'kernel32::GetLongPathNameA(t r0, t .r1, i 1024)i .r2'
  1372.             StrCmp $2 error +2
  1373.             StrCpy $0 $1
  1374.             Pop $2
  1375.             Pop $1
  1376.             Exch $0
  1377.         FunctionEnd
  1378.  
  1379.         !verbose pop
  1380.     !endif
  1381. !macroend
  1382.  
  1383. !macro GetExePath
  1384.     !ifndef ${_FILEFUNC_UN}GetExePath
  1385.         !verbose push
  1386.         !verbose ${_FILEFUNC_VERBOSE}
  1387.         !define ${_FILEFUNC_UN}GetExePath `!insertmacro ${_FILEFUNC_UN}GetExePathCall`
  1388.  
  1389.         Function ${_FILEFUNC_UN}GetExePath
  1390.             Push $0
  1391.             Push $1
  1392.             Push $2
  1393.             StrCpy $0 $EXEDIR
  1394.             System::Call 'kernel32::GetLongPathNameA(t r0, t .r1, i 1024)i .r2'
  1395.             StrCmp $2 error +2
  1396.             StrCpy $0 $1
  1397.             Pop $2
  1398.             Pop $1
  1399.             Exch $0
  1400.         FunctionEnd
  1401.  
  1402.         !verbose pop
  1403.     !endif
  1404. !macroend
  1405.  
  1406. !macro GetParameters
  1407.     !ifndef ${_FILEFUNC_UN}GetParameters
  1408.         !verbose push
  1409.         !verbose ${_FILEFUNC_VERBOSE}
  1410.         !define ${_FILEFUNC_UN}GetParameters `!insertmacro ${_FILEFUNC_UN}GetParametersCall`
  1411.  
  1412.         Function ${_FILEFUNC_UN}GetParameters
  1413.             Push $0
  1414.             Push $1
  1415.             Push $2
  1416.  
  1417.             StrCpy $1 1
  1418.             StrCpy $0 $CMDLINE 1
  1419.             StrCmp $0 '"' 0 +3
  1420.             StrCpy $2 '"'
  1421.             goto +2
  1422.             StrCpy $2 ' '
  1423.  
  1424.             IntOp $1 $1 + 1
  1425.             StrCpy $0 $CMDLINE 1 $1
  1426.             StrCmp $0 $2 +2
  1427.             StrCmp $0 '' end -3
  1428.  
  1429.             IntOp $1 $1 + 1
  1430.             StrCpy $0 $CMDLINE 1 $1
  1431.             StrCmp $0 ' ' -2
  1432.             StrCpy $0 $CMDLINE '' $1
  1433.  
  1434.             StrCpy $1 $0 1 -1
  1435.             StrCmp $1 ' ' 0 +3
  1436.             StrCpy $0 $0 -1
  1437.             goto -3
  1438.  
  1439.             end:
  1440.             Pop $2
  1441.             Pop $1
  1442.             Exch $0
  1443.         FunctionEnd
  1444.  
  1445.         !verbose pop
  1446.     !endif
  1447. !macroend
  1448.  
  1449. !macro GetOptions
  1450.     !ifndef ${_FILEFUNC_UN}GetOptions${_FILEFUNC_S}
  1451.         !verbose push
  1452.         !verbose ${_FILEFUNC_VERBOSE}
  1453.         !define ${_FILEFUNC_UN}GetOptions${_FILEFUNC_S} `!insertmacro ${_FILEFUNC_UN}GetOptions${_FILEFUNC_S}Call`
  1454.  
  1455.         Function ${_FILEFUNC_UN}GetOptions${_FILEFUNC_S}
  1456.             Exch $1
  1457.             Exch
  1458.             Exch $0
  1459.             Exch
  1460.             Push $2
  1461.             Push $3
  1462.             Push $4
  1463.             Push $5
  1464.             Push $6
  1465.             Push $7
  1466.             ClearErrors
  1467.  
  1468.             StrCpy $2 $1 '' 1
  1469.             StrCpy $1 $1 1
  1470.             StrLen $3 $2
  1471.             StrCpy $7 0
  1472.  
  1473.             begin:
  1474.             StrCpy $4 -1
  1475.             StrCpy $6 ''
  1476.  
  1477.             quote:
  1478.             IntOp $4 $4 + 1
  1479.             StrCpy $5 $0 1 $4
  1480.             StrCmp${_FILEFUNC_S} $5$7 '0' notfound
  1481.             StrCmp${_FILEFUNC_S} $5 '' trimright
  1482.             StrCmp${_FILEFUNC_S} $5 '"' 0 +7
  1483.             StrCmp${_FILEFUNC_S} $6 '' 0 +3
  1484.             StrCpy $6 '"'
  1485.             goto quote
  1486.             StrCmp${_FILEFUNC_S} $6 '"' 0 +3
  1487.             StrCpy $6 ''
  1488.             goto quote
  1489.             StrCmp${_FILEFUNC_S} $5 `'` 0 +7
  1490.             StrCmp${_FILEFUNC_S} $6 `` 0 +3
  1491.             StrCpy $6 `'`
  1492.             goto quote
  1493.             StrCmp${_FILEFUNC_S} $6 `'` 0 +3
  1494.             StrCpy $6 ``
  1495.             goto quote
  1496.             StrCmp${_FILEFUNC_S} $5 '`' 0 +7
  1497.             StrCmp${_FILEFUNC_S} $6 '' 0 +3
  1498.             StrCpy $6 '`'
  1499.             goto quote
  1500.             StrCmp${_FILEFUNC_S} $6 '`' 0 +3
  1501.             StrCpy $6 ''
  1502.             goto quote
  1503.             StrCmp${_FILEFUNC_S} $6 '"' quote
  1504.             StrCmp${_FILEFUNC_S} $6 `'` quote
  1505.             StrCmp${_FILEFUNC_S} $6 '`' quote
  1506.             StrCmp${_FILEFUNC_S} $5 $1 0 quote
  1507.             StrCmp${_FILEFUNC_S} $7 0 trimleft trimright
  1508.  
  1509.             trimleft:
  1510.             IntOp $4 $4 + 1
  1511.             StrCpy $5 $0 $3 $4
  1512.             StrCmp${_FILEFUNC_S} $5 '' notfound
  1513.             StrCmp${_FILEFUNC_S} $5 $2 0 quote
  1514.             IntOp $4 $4 + $3
  1515.             StrCpy $0 $0 '' $4
  1516.             StrCpy $4 $0 1
  1517.             StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
  1518.             StrCpy $0 $0 '' 1
  1519.             goto -3
  1520.             StrCpy $7 1
  1521.             goto begin
  1522.  
  1523.             trimright:
  1524.             StrCpy $0 $0 $4
  1525.             StrCpy $4 $0 1 -1
  1526.             StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
  1527.             StrCpy $0 $0 -1
  1528.             goto -3
  1529.             StrCpy $3 $0 1
  1530.             StrCpy $4 $0 1 -1
  1531.             StrCmp${_FILEFUNC_S} $3 $4 0 end
  1532.             StrCmp${_FILEFUNC_S} $3 '"' +3
  1533.             StrCmp${_FILEFUNC_S} $3 `'` +2
  1534.             StrCmp${_FILEFUNC_S} $3 '`' 0 end
  1535.             StrCpy $0 $0 -1 1
  1536.             goto end
  1537.  
  1538.             notfound:
  1539.             SetErrors
  1540.             StrCpy $0 ''
  1541.  
  1542.             end:
  1543.             Pop $7
  1544.             Pop $6
  1545.             Pop $5
  1546.             Pop $4
  1547.             Pop $3
  1548.             Pop $2
  1549.             Pop $1
  1550.             Exch $0
  1551.         FunctionEnd
  1552.  
  1553.         !verbose pop
  1554.     !endif
  1555. !macroend
  1556.  
  1557.  
  1558. !macro GetRoot
  1559.     !ifndef ${_FILEFUNC_UN}GetRoot
  1560.         !verbose push
  1561.         !verbose ${_FILEFUNC_VERBOSE}
  1562.         !define ${_FILEFUNC_UN}GetRoot `!insertmacro ${_FILEFUNC_UN}GetRootCall`
  1563.  
  1564.         Function ${_FILEFUNC_UN}GetRoot
  1565.             Exch $0
  1566.             Push $1
  1567.             Push $2
  1568.             Push $3
  1569.  
  1570.             StrCpy $1 $0 2
  1571.             StrCmp $1 '\\' UNC
  1572.             StrCpy $2 $1 1 1
  1573.             StrCmp $2 ':' 0 empty
  1574.             StrCpy $0 $1
  1575.             goto end
  1576.  
  1577.             UNC:
  1578.             StrCpy $2 1
  1579.             StrCpy $3 ''
  1580.  
  1581.             loop:
  1582.             IntOp $2 $2 + 1
  1583.             StrCpy $1 $0 1 $2
  1584.             StrCmp $1$3 '' empty
  1585.             StrCmp $1 '' +5
  1586.             StrCmp $1 '\' 0 loop
  1587.             StrCmp $3 '1' +3
  1588.             StrCpy $3 '1'
  1589.             goto loop
  1590.             StrCpy $0 $0 $2
  1591.             StrCpy $2 $0 1 -1
  1592.             StrCmp $2 '\' 0 end
  1593.  
  1594.             empty:
  1595.             StrCpy $0 ''
  1596.  
  1597.             end:
  1598.             Pop $3
  1599.             Pop $2
  1600.             Pop $1
  1601.             Exch $0
  1602.         FunctionEnd
  1603.  
  1604.         !verbose pop
  1605.     !endif
  1606. !macroend
  1607.  
  1608. !macro GetParent
  1609.     !ifndef ${_FILEFUNC_UN}GetParent
  1610.         !verbose push
  1611.         !verbose ${_FILEFUNC_VERBOSE}
  1612.         !define ${_FILEFUNC_UN}GetParent `!insertmacro ${_FILEFUNC_UN}GetParentCall`
  1613.  
  1614.         Function ${_FILEFUNC_UN}GetParent
  1615.             Exch $0
  1616.             Push $1
  1617.             Push $2
  1618.  
  1619.             StrCpy $2 $0 1 -1
  1620.             StrCmp $2 '\' 0 +3
  1621.             StrCpy $0 $0 -1
  1622.             goto -3
  1623.  
  1624.             StrCpy $1 0
  1625.             IntOp $1 $1 - 1
  1626.             StrCpy $2 $0 1 $1
  1627.             StrCmp $2 '\' +2
  1628.             StrCmp $2 '' 0 -3
  1629.             StrCpy $0 $0 $1
  1630.  
  1631.             Pop $2
  1632.             Pop $1
  1633.             Exch $0
  1634.         FunctionEnd
  1635.  
  1636.         !verbose pop
  1637.     !endif
  1638. !macroend
  1639.  
  1640. !macro GetFileName
  1641.     !ifndef ${_FILEFUNC_UN}GetFileName
  1642.         !verbose push
  1643.         !verbose ${_FILEFUNC_VERBOSE}
  1644.         !define ${_FILEFUNC_UN}GetFileName `!insertmacro ${_FILEFUNC_UN}GetFileNameCall`
  1645.  
  1646.         Function ${_FILEFUNC_UN}GetFileName
  1647.             Exch $0
  1648.             Push $1
  1649.             Push $2
  1650.  
  1651.             StrCpy $2 $0 1 -1
  1652.             StrCmp $2 '\' 0 +3
  1653.             StrCpy $0 $0 -1
  1654.             goto -3
  1655.  
  1656.             StrCpy $1 0
  1657.             IntOp $1 $1 - 1
  1658.             StrCpy $2 $0 1 $1
  1659.             StrCmp $2 '' end
  1660.             StrCmp $2 '\' 0 -3
  1661.             IntOp $1 $1 + 1
  1662.             StrCpy $0 $0 '' $1
  1663.  
  1664.             end:
  1665.             Pop $2
  1666.             Pop $1
  1667.             Exch $0
  1668.         FunctionEnd
  1669.  
  1670.         !verbose pop
  1671.     !endif
  1672. !macroend
  1673.  
  1674. !macro GetBaseName
  1675.     !ifndef ${_FILEFUNC_UN}GetBaseName
  1676.         !verbose push
  1677.         !verbose ${_FILEFUNC_VERBOSE}
  1678.         !define ${_FILEFUNC_UN}GetBaseName `!insertmacro ${_FILEFUNC_UN}GetBaseNameCall`
  1679.  
  1680.         Function ${_FILEFUNC_UN}GetBaseName
  1681.             Exch $0
  1682.             Push $1
  1683.             Push $2
  1684.             Push $3
  1685.  
  1686.             StrCpy $1 0
  1687.             StrCpy $3 ''
  1688.  
  1689.             loop:
  1690.             IntOp $1 $1 - 1
  1691.             StrCpy $2 $0 1 $1
  1692.             StrCmp $2 '' trimpath
  1693.             StrCmp $2 '\' trimpath
  1694.             StrCmp $3 'noext' loop
  1695.             StrCmp $2 '.' 0 loop
  1696.             StrCpy $0 $0 $1
  1697.             StrCpy $3 'noext'
  1698.             StrCpy $1 0
  1699.             goto loop
  1700.  
  1701.             trimpath:
  1702.             StrCmp $1 -1 empty
  1703.             IntOp $1 $1 + 1
  1704.             StrCpy $0 $0 '' $1
  1705.             goto end
  1706.  
  1707.             empty:
  1708.             StrCpy $0 ''
  1709.  
  1710.             end:
  1711.             Pop $3
  1712.             Pop $2
  1713.             Pop $1
  1714.             Exch $0
  1715.         FunctionEnd
  1716.  
  1717.         !verbose pop
  1718.     !endif
  1719. !macroend
  1720.  
  1721. !macro GetFileExt
  1722.     !ifndef ${_FILEFUNC_UN}GetFileExt
  1723.         !verbose push
  1724.         !verbose ${_FILEFUNC_VERBOSE}
  1725.         !define ${_FILEFUNC_UN}GetFileExt `!insertmacro ${_FILEFUNC_UN}GetFileExtCall`
  1726.  
  1727.         Function ${_FILEFUNC_UN}GetFileExt
  1728.             Exch $0
  1729.             Push $1
  1730.             Push $2
  1731.  
  1732.             StrCpy $1 0
  1733.  
  1734.             loop:
  1735.             IntOp $1 $1 - 1
  1736.             StrCpy $2 $0 1 $1
  1737.             StrCmp $2 '' empty
  1738.             StrCmp $2 '\' empty
  1739.             StrCmp $2 '.' 0 loop
  1740.  
  1741.             StrCmp $1 -1 empty
  1742.             IntOp $1 $1 + 1
  1743.             StrCpy $0 $0 '' $1
  1744.             goto end
  1745.  
  1746.             empty:
  1747.             StrCpy $0 ''
  1748.  
  1749.             end:
  1750.             Pop $2
  1751.             Pop $1
  1752.             Exch $0
  1753.         FunctionEnd
  1754.  
  1755.         !verbose pop
  1756.     !endif
  1757. !macroend
  1758.  
  1759. !macro BannerTrimPath
  1760.     !ifndef ${_FILEFUNC_UN}BannerTrimPath
  1761.         !verbose push
  1762.         !verbose ${_FILEFUNC_VERBOSE}
  1763.         !define ${_FILEFUNC_UN}BannerTrimPath `!insertmacro ${_FILEFUNC_UN}BannerTrimPathCall`
  1764.  
  1765.         Function ${_FILEFUNC_UN}BannerTrimPath
  1766.             Exch $1
  1767.             Exch
  1768.             Exch $0
  1769.             Exch
  1770.             Push $2
  1771.             Push $3
  1772.             Push $4
  1773.  
  1774.             StrCpy $3 $1 1 -1
  1775.             IntOp $1 $1 + 0
  1776.             StrLen $2 $0
  1777.             IntCmp $2 $1 end end
  1778.             IntOp $1 $1 - 3
  1779.             IntCmp $1 0 empty empty
  1780.             StrCmp $3 'A' A-trim
  1781.             StrCmp $3 'B' B-trim
  1782.             StrCmp $3 'C' C-trim
  1783.             StrCmp $3 'D' D-trim
  1784.  
  1785.             A-trim:
  1786.             StrCpy $3 $0 1 1
  1787.             StrCpy $2 0
  1788.             StrCmp $3 ':' 0 +2
  1789.             IntOp $2 $2 + 2
  1790.  
  1791.             loopleft:
  1792.             IntOp $2 $2 + 1
  1793.             StrCpy $3 $0 1 $2
  1794.             StrCmp $2 $1 C-trim
  1795.             StrCmp $3 '\' 0 loopleft
  1796.             StrCpy $3 $0 $2
  1797.             IntOp $2 $2 - $1
  1798.             IntCmp $2 0 B-trim 0 B-trim
  1799.  
  1800.             loopright:
  1801.             IntOp $2 $2 + 1
  1802.             StrCpy $4 $0 1 $2
  1803.             StrCmp $2 0 B-trim
  1804.             StrCmp $4 '\' 0 loopright
  1805.             StrCpy $4 $0 '' $2
  1806.             StrCpy $0 '$3\...$4'
  1807.             goto end
  1808.  
  1809.             B-trim:
  1810.             StrCpy $2 $1
  1811.             IntOp $2 $2 - 1
  1812.             StrCmp $2 -1 C-trim
  1813.             StrCpy $3 $0 1 $2
  1814.             StrCmp $3 '\' 0 -3
  1815.             StrCpy $0 $0 $2
  1816.             StrCpy $0 '$0\...'
  1817.             goto end
  1818.  
  1819.             C-trim:
  1820.             StrCpy $0 $0 $1
  1821.             StrCpy $0 '$0...'
  1822.             goto end
  1823.  
  1824.             D-trim:
  1825.             StrCpy $3 -1
  1826.             IntOp $3 $3 - 1
  1827.             StrCmp $3 -$2 C-trim
  1828.             StrCpy $4 $0 1 $3
  1829.             StrCmp $4 '\' 0 -3
  1830.             StrCpy $4 $0 '' $3
  1831.             IntOp $3 $1 + $3
  1832.             IntCmp $3 2 C-trim C-trim
  1833.             StrCpy $0 $0 $3
  1834.             StrCpy $0 '$0...$4'
  1835.             goto end
  1836.  
  1837.             empty:
  1838.             StrCpy $0 ''
  1839.  
  1840.             end:
  1841.             Pop $4
  1842.             Pop $3
  1843.             Pop $2
  1844.             Pop $1
  1845.             Exch $0
  1846.         FunctionEnd
  1847.  
  1848.         !verbose pop
  1849.     !endif
  1850. !macroend
  1851.  
  1852. !macro DirState
  1853.     !ifndef ${_FILEFUNC_UN}DirState
  1854.         !verbose push
  1855.         !verbose ${_FILEFUNC_VERBOSE}
  1856.         !define ${_FILEFUNC_UN}DirState `!insertmacro ${_FILEFUNC_UN}DirStateCall`
  1857.  
  1858.         Function ${_FILEFUNC_UN}DirState
  1859.             Exch $0
  1860.             Push $1
  1861.             ClearErrors
  1862.  
  1863.             FindFirst $1 $0 '$0\*.*'
  1864.             IfErrors 0 +3
  1865.             StrCpy $0 -1
  1866.             goto end
  1867.             StrCmp $0 '.' 0 +4
  1868.             FindNext $1 $0
  1869.             StrCmp $0 '..' 0 +2
  1870.             FindNext $1 $0
  1871.             FindClose $1
  1872.             IfErrors 0 +3
  1873.             StrCpy $0 0
  1874.             goto end
  1875.             StrCpy $0 1
  1876.  
  1877.             end:
  1878.             Pop $1
  1879.             Exch $0
  1880.         FunctionEnd
  1881.  
  1882.         !verbose pop
  1883.     !endif
  1884. !macroend
  1885.  
  1886. !macro RefreshShellIcons
  1887.     !ifndef ${_FILEFUNC_UN}RefreshShellIcons
  1888.         !verbose push
  1889.         !verbose ${_FILEFUNC_VERBOSE}
  1890.         !define ${_FILEFUNC_UN}RefreshShellIcons `!insertmacro ${_FILEFUNC_UN}RefreshShellIconsCall`
  1891.  
  1892.         Function ${_FILEFUNC_UN}RefreshShellIcons
  1893.             System::Call 'shell32::SHChangeNotify(i 0x08000000, i 0, i 0, i 0)'
  1894.         FunctionEnd
  1895.  
  1896.         !verbose pop
  1897.     !endif
  1898. !macroend
  1899.  
  1900.  
  1901. # Uninstall. Case insensitive. #
  1902.  
  1903. !macro un.LocateCall _PATH _OPTIONS _FUNC
  1904.     !verbose push
  1905.     !verbose ${_FILEFUNC_VERBOSE}
  1906.     Push $0
  1907.     Push `${_PATH}`
  1908.     Push `${_OPTIONS}`
  1909.     GetFunctionAddress $0 `${_FUNC}`
  1910.     Push `$0`
  1911.     Call un.Locate
  1912.     Pop $0
  1913.     !verbose pop
  1914. !macroend
  1915.  
  1916. !macro un.GetSizeCall _PATH _OPTIONS _RESULT1 _RESULT2 _RESULT3
  1917.     !verbose push
  1918.     !verbose ${_FILEFUNC_VERBOSE}
  1919.     Push `${_PATH}`
  1920.     Push `${_OPTIONS}`
  1921.     Call un.GetSize
  1922.     Pop ${_RESULT1}
  1923.     Pop ${_RESULT2}
  1924.     Pop ${_RESULT3}
  1925.     !verbose pop
  1926. !macroend
  1927.  
  1928. !macro un.DriveSpaceCall _DRIVE _OPTIONS _RESULT
  1929.     !verbose push
  1930.     !verbose ${_FILEFUNC_VERBOSE}
  1931.     Push `${_DRIVE}`
  1932.     Push `${_OPTIONS}`
  1933.     Call un.DriveSpace
  1934.     Pop ${_RESULT}
  1935.     !verbose pop
  1936. !macroend
  1937.  
  1938. !macro un.GetDrivesCall _DRV _FUNC
  1939.     !verbose push
  1940.     !verbose ${_FILEFUNC_VERBOSE}
  1941.     Push $0
  1942.     Push `${_DRV}`
  1943.     GetFunctionAddress $0 `${_FUNC}`
  1944.     Push `$0`
  1945.     Call un.GetDrives
  1946.     Pop $0
  1947.     !verbose pop
  1948. !macroend
  1949.  
  1950. !macro un.GetTimeCall _FILE _OPTION _RESULT1 _RESULT2 _RESULT3 _RESULT4 _RESULT5 _RESULT6 _RESULT7
  1951.     !verbose push
  1952.     !verbose ${_FILEFUNC_VERBOSE}
  1953.     Push `${_FILE}`
  1954.     Push `${_OPTION}`
  1955.     Call un.GetTime
  1956.     Pop ${_RESULT1}
  1957.     Pop ${_RESULT2}
  1958.     Pop ${_RESULT3}
  1959.     Pop ${_RESULT4}
  1960.     Pop ${_RESULT5}
  1961.     Pop ${_RESULT6}
  1962.     Pop ${_RESULT7}
  1963.     !verbose pop
  1964. !macroend
  1965.  
  1966. !macro un.GetFileAttributesCall _PATH _ATTR _RESULT
  1967.     !verbose push
  1968.     !verbose ${_FILEFUNC_VERBOSE}
  1969.     Push `${_PATH}`
  1970.     Push `${_ATTR}`
  1971.     Call un.GetFileAttributes
  1972.     Pop ${_RESULT}
  1973.     !verbose pop
  1974. !macroend
  1975.  
  1976. !macro un.GetFileVersionCall _FILE _RESULT
  1977.     !verbose push
  1978.     !verbose ${_FILEFUNC_VERBOSE}
  1979.     Push `${_FILE}`
  1980.     Call un.GetFileVersion
  1981.     Pop ${_RESULT}
  1982.     !verbose pop
  1983. !macroend
  1984.  
  1985. !macro un.GetExeNameCall _RESULT
  1986.     !verbose push
  1987.     !verbose ${_FILEFUNC_VERBOSE}
  1988.     Call un.GetExeName
  1989.     Pop ${_RESULT}
  1990.     !verbose pop
  1991. !macroend
  1992.  
  1993. !macro un.GetExePathCall _RESULT
  1994.     !verbose push
  1995.     !verbose ${_FILEFUNC_VERBOSE}
  1996.     Call un.GetExePath
  1997.     Pop ${_RESULT}
  1998.     !verbose pop
  1999. !macroend
  2000.  
  2001. !macro un.GetParametersCall _RESULT
  2002.     !verbose push
  2003.     !verbose ${_FILEFUNC_VERBOSE}
  2004.     Call un.GetParameters
  2005.     Pop ${_RESULT}
  2006.     !verbose pop
  2007. !macroend
  2008.  
  2009. !macro un.GetOptionsCall _PARAMETERS _OPTION _RESULT
  2010.     !verbose push
  2011.     !verbose ${_FILEFUNC_VERBOSE}
  2012.     Push `${_PARAMETERS}`
  2013.     Push `${_OPTION}`
  2014.     Call un.GetOptions
  2015.     Pop ${_RESULT}
  2016.     !verbose pop
  2017. !macroend
  2018.  
  2019. !macro un.GetRootCall _FULLPATH _RESULT
  2020.     !verbose push
  2021.     !verbose ${_FILEFUNC_VERBOSE}
  2022.     Push `${_FULLPATH}`
  2023.     Call un.GetRoot
  2024.     Pop ${_RESULT}
  2025.     !verbose pop
  2026. !macroend
  2027.  
  2028. !macro un.GetParentCall _PATHSTRING _RESULT
  2029.     !verbose push
  2030.     !verbose ${_FILEFUNC_VERBOSE}
  2031.     Push `${_PATHSTRING}`
  2032.     Call un.GetParent
  2033.     Pop ${_RESULT}
  2034.     !verbose pop
  2035. !macroend
  2036.  
  2037. !macro un.GetFileNameCall _PATHSTRING _RESULT
  2038.     !verbose push
  2039.     !verbose ${_FILEFUNC_VERBOSE}
  2040.     Push `${_PATHSTRING}`
  2041.     Call un.GetFileName
  2042.     Pop ${_RESULT}
  2043.     !verbose pop
  2044. !macroend
  2045.  
  2046. !macro un.GetBaseNameCall _FILESTRING _RESULT
  2047.     !verbose push
  2048.     !verbose ${_FILEFUNC_VERBOSE}
  2049.     Push `${_FILESTRING}`
  2050.     Call un.GetBaseName
  2051.     Pop ${_RESULT}
  2052.     !verbose pop
  2053. !macroend
  2054.  
  2055. !macro un.GetFileExtCall _FILESTRING _RESULT
  2056.     !verbose push
  2057.     !verbose ${_FILEFUNC_VERBOSE}
  2058.     Push `${_FILESTRING}`
  2059.     Call un.GetFileExt
  2060.     Pop ${_RESULT}
  2061.     !verbose pop
  2062. !macroend
  2063.  
  2064. !macro un.BannerTrimPathCall _PATH _LENGHT _RESULT
  2065.     !verbose push
  2066.     !verbose ${_FILEFUNC_VERBOSE}
  2067.     Push `${_PATH}`
  2068.     Push `${_LENGHT}`
  2069.     Call un.BannerTrimPath
  2070.     Pop ${_RESULT}
  2071.     !verbose pop
  2072. !macroend
  2073.  
  2074. !macro un.DirStateCall _PATH _RESULT
  2075.     !verbose push
  2076.     !verbose ${_FILEFUNC_VERBOSE}
  2077.     Push `${_PATH}`
  2078.     Call un.DirState
  2079.     Pop ${_RESULT}
  2080.     !verbose pop
  2081. !macroend
  2082.  
  2083. !macro un.RefreshShellIconsCall
  2084.     !verbose push
  2085.     !verbose ${_FILEFUNC_VERBOSE}
  2086.     Call un.RefreshShellIcons
  2087.     !verbose pop
  2088. !macroend
  2089.  
  2090. !macro un.Locate
  2091.     !ifndef un.Locate
  2092.         !verbose push
  2093.         !verbose ${_FILEFUNC_VERBOSE}
  2094.         !undef _FILEFUNC_UN
  2095.         !define _FILEFUNC_UN `un.`
  2096.  
  2097.         !insertmacro Locate
  2098.  
  2099.         !undef _FILEFUNC_UN
  2100.         !define _FILEFUNC_UN
  2101.         !verbose pop
  2102.     !endif
  2103. !macroend
  2104.  
  2105. !macro un.GetSize
  2106.     !ifndef un.GetSize
  2107.         !verbose push
  2108.         !verbose ${_FILEFUNC_VERBOSE}
  2109.         !undef _FILEFUNC_UN
  2110.         !define _FILEFUNC_UN `un.`
  2111.  
  2112.         !insertmacro GetSize
  2113.  
  2114.         !undef _FILEFUNC_UN
  2115.         !define _FILEFUNC_UN
  2116.         !verbose pop
  2117.     !endif
  2118. !macroend
  2119.  
  2120. !macro un.DriveSpace
  2121.     !ifndef un.DriveSpace
  2122.         !verbose push
  2123.         !verbose ${_FILEFUNC_VERBOSE}
  2124.         !undef _FILEFUNC_UN
  2125.         !define _FILEFUNC_UN `un.`
  2126.  
  2127.         !insertmacro DriveSpace
  2128.  
  2129.         !undef _FILEFUNC_UN
  2130.         !define _FILEFUNC_UN
  2131.         !verbose pop
  2132.     !endif
  2133. !macroend
  2134.  
  2135. !macro un.GetDrives
  2136.     !ifndef un.GetDrives
  2137.         !verbose push
  2138.         !verbose ${_FILEFUNC_VERBOSE}
  2139.         !undef _FILEFUNC_UN
  2140.         !define _FILEFUNC_UN `un.`
  2141.  
  2142.         !insertmacro GetDrives
  2143.  
  2144.         !undef _FILEFUNC_UN
  2145.         !define _FILEFUNC_UN
  2146.         !verbose pop
  2147.     !endif
  2148. !macroend
  2149.  
  2150. !macro un.GetTime
  2151.     !ifndef un.GetTime
  2152.         !verbose push
  2153.         !verbose ${_FILEFUNC_VERBOSE}
  2154.         !undef _FILEFUNC_UN
  2155.         !define _FILEFUNC_UN `un.`
  2156.  
  2157.         !insertmacro GetTime
  2158.  
  2159.         !undef _FILEFUNC_UN
  2160.         !define _FILEFUNC_UN
  2161.         !verbose pop
  2162.     !endif
  2163. !macroend
  2164.  
  2165. !macro un.GetFileAttributes
  2166.     !ifndef un.GetFileAttributes
  2167.         !verbose push
  2168.         !verbose ${_FILEFUNC_VERBOSE}
  2169.         !undef _FILEFUNC_UN
  2170.         !define _FILEFUNC_UN `un.`
  2171.  
  2172.         !insertmacro GetFileAttributes
  2173.  
  2174.         !undef _FILEFUNC_UN
  2175.         !define _FILEFUNC_UN
  2176.         !verbose pop
  2177.     !endif
  2178. !macroend
  2179.  
  2180. !macro un.GetFileVersion
  2181.     !ifndef un.GetFileVersion
  2182.         !verbose push
  2183.         !verbose ${_FILEFUNC_VERBOSE}
  2184.         !undef _FILEFUNC_UN
  2185.         !define _FILEFUNC_UN `un.`
  2186.  
  2187.         !insertmacro GetFileVersion
  2188.  
  2189.         !undef _FILEFUNC_UN
  2190.         !define _FILEFUNC_UN
  2191.         !verbose pop
  2192.     !endif
  2193. !macroend
  2194.  
  2195. !macro un.GetExeName
  2196.     !ifndef un.GetExeName
  2197.         !verbose push
  2198.         !verbose ${_FILEFUNC_VERBOSE}
  2199.         !undef _FILEFUNC_UN
  2200.         !define _FILEFUNC_UN `un.`
  2201.  
  2202.         !insertmacro GetExeName
  2203.  
  2204.         !undef _FILEFUNC_UN
  2205.         !define _FILEFUNC_UN
  2206.         !verbose pop
  2207.     !endif
  2208. !macroend
  2209.  
  2210. !macro un.GetExePath
  2211.     !ifndef un.GetExePath
  2212.         !verbose push
  2213.         !verbose ${_FILEFUNC_VERBOSE}
  2214.         !undef _FILEFUNC_UN
  2215.         !define _FILEFUNC_UN `un.`
  2216.  
  2217.         !insertmacro GetExePath
  2218.  
  2219.         !undef _FILEFUNC_UN
  2220.         !define _FILEFUNC_UN
  2221.         !verbose pop
  2222.     !endif
  2223. !macroend
  2224.  
  2225. !macro un.GetParameters
  2226.     !ifndef un.GetParameters
  2227.         !verbose push
  2228.         !verbose ${_FILEFUNC_VERBOSE}
  2229.         !undef _FILEFUNC_UN
  2230.         !define _FILEFUNC_UN `un.`
  2231.  
  2232.         !insertmacro GetParameters
  2233.  
  2234.         !undef _FILEFUNC_UN
  2235.         !define _FILEFUNC_UN
  2236.         !verbose pop
  2237.     !endif
  2238. !macroend
  2239.  
  2240. !macro un.GetOptions
  2241.     !ifndef un.GetOptions
  2242.         !verbose push
  2243.         !verbose ${_FILEFUNC_VERBOSE}
  2244.         !undef _FILEFUNC_UN
  2245.         !define _FILEFUNC_UN `un.`
  2246.  
  2247.         !insertmacro GetOptions
  2248.  
  2249.         !undef _FILEFUNC_UN
  2250.         !define _FILEFUNC_UN
  2251.         !verbose pop
  2252.     !endif
  2253. !macroend
  2254.  
  2255. !macro un.GetRoot
  2256.     !ifndef un.GetRoot
  2257.         !verbose push
  2258.         !verbose ${_FILEFUNC_VERBOSE}
  2259.         !undef _FILEFUNC_UN
  2260.         !define _FILEFUNC_UN `un.`
  2261.  
  2262.         !insertmacro GetRoot
  2263.  
  2264.         !undef _FILEFUNC_UN
  2265.         !define _FILEFUNC_UN
  2266.         !verbose pop
  2267.     !endif
  2268. !macroend
  2269.  
  2270. !macro un.GetParent
  2271.     !ifndef un.GetParent
  2272.         !verbose push
  2273.         !verbose ${_FILEFUNC_VERBOSE}
  2274.         !undef _FILEFUNC_UN
  2275.         !define _FILEFUNC_UN `un.`
  2276.  
  2277.         !insertmacro GetParent
  2278.  
  2279.         !undef _FILEFUNC_UN
  2280.         !define _FILEFUNC_UN
  2281.         !verbose pop
  2282.     !endif
  2283. !macroend
  2284.  
  2285. !macro un.GetFileName
  2286.     !ifndef un.GetFileName
  2287.         !verbose push
  2288.         !verbose ${_FILEFUNC_VERBOSE}
  2289.         !undef _FILEFUNC_UN
  2290.         !define _FILEFUNC_UN `un.`
  2291.  
  2292.         !insertmacro GetFileName
  2293.  
  2294.         !undef _FILEFUNC_UN
  2295.         !define _FILEFUNC_UN
  2296.         !verbose pop
  2297.     !endif
  2298. !macroend
  2299.  
  2300. !macro un.GetBaseName
  2301.     !ifndef un.GetBaseName
  2302.         !verbose push
  2303.         !verbose ${_FILEFUNC_VERBOSE}
  2304.         !undef _FILEFUNC_UN
  2305.         !define _FILEFUNC_UN `un.`
  2306.  
  2307.         !insertmacro GetBaseName
  2308.  
  2309.         !undef _FILEFUNC_UN
  2310.         !define _FILEFUNC_UN
  2311.         !verbose pop
  2312.     !endif
  2313. !macroend
  2314.  
  2315. !macro un.GetFileExt
  2316.     !ifndef un.GetFileExt
  2317.         !verbose push
  2318.         !verbose ${_FILEFUNC_VERBOSE}
  2319.         !undef _FILEFUNC_UN
  2320.         !define _FILEFUNC_UN `un.`
  2321.  
  2322.         !insertmacro GetFileExt
  2323.  
  2324.         !undef _FILEFUNC_UN
  2325.         !define _FILEFUNC_UN
  2326.         !verbose pop
  2327.     !endif
  2328. !macroend
  2329.  
  2330. !macro un.BannerTrimPath
  2331.     !ifndef un.BannerTrimPath
  2332.         !verbose push
  2333.         !verbose ${_FILEFUNC_VERBOSE}
  2334.         !undef _FILEFUNC_UN
  2335.         !define _FILEFUNC_UN `un.`
  2336.  
  2337.         !insertmacro BannerTrimPath
  2338.  
  2339.         !undef _FILEFUNC_UN
  2340.         !define _FILEFUNC_UN
  2341.         !verbose pop
  2342.     !endif
  2343. !macroend
  2344.  
  2345. !macro un.DirState
  2346.     !ifndef un.DirState
  2347.         !verbose push
  2348.         !verbose ${_FILEFUNC_VERBOSE}
  2349.         !undef _FILEFUNC_UN
  2350.         !define _FILEFUNC_UN `un.`
  2351.  
  2352.         !insertmacro DirState
  2353.  
  2354.         !undef _FILEFUNC_UN
  2355.         !define _FILEFUNC_UN
  2356.         !verbose pop
  2357.     !endif
  2358. !macroend
  2359.  
  2360. !macro un.RefreshShellIcons
  2361.     !ifndef un.RefreshShellIcons
  2362.         !verbose push
  2363.         !verbose ${_FILEFUNC_VERBOSE}
  2364.         !undef _FILEFUNC_UN
  2365.         !define _FILEFUNC_UN `un.`
  2366.  
  2367.         !insertmacro RefreshShellIcons
  2368.  
  2369.         !undef _FILEFUNC_UN
  2370.         !define _FILEFUNC_UN
  2371.         !verbose pop
  2372.     !endif
  2373. !macroend
  2374.  
  2375.  
  2376. # Install. Case sensitive. #
  2377.  
  2378. !macro GetOptionsSCall _PARAMETERS _OPTION _RESULT
  2379.     !verbose push
  2380.     !verbose ${_FILEFUNC_VERBOSE}
  2381.     Push `${_PARAMETERS}`
  2382.     Push `${_OPTION}`
  2383.     Call GetOptionsS
  2384.     Pop ${_RESULT}
  2385.     !verbose pop
  2386. !macroend
  2387.  
  2388. !macro GetOptionsS
  2389.     !ifndef GetOptionsS
  2390.         !verbose push
  2391.         !verbose ${_FILEFUNC_VERBOSE}
  2392.         !undef _FILEFUNC_S
  2393.         !define _FILEFUNC_S `S`
  2394.  
  2395.         !insertmacro GetOptions
  2396.  
  2397.         !undef _FILEFUNC_S
  2398.         !define _FILEFUNC_S
  2399.         !verbose pop
  2400.     !endif
  2401. !macroend
  2402.  
  2403.  
  2404. # Uninstall. Case sensitive. #
  2405.  
  2406. !macro un.GetOptionsSCall _PARAMETERS _OPTION _RESULT
  2407.     !verbose push
  2408.     !verbose ${_FILEFUNC_VERBOSE}
  2409.     Push `${_PARAMETERS}`
  2410.     Push `${_OPTION}`
  2411.     Call un.GetOptionsS
  2412.     Pop ${_RESULT}
  2413.     !verbose pop
  2414. !macroend
  2415.  
  2416. !macro un.GetOptionsS
  2417.     !ifndef un.GetOptionsS
  2418.         !verbose push
  2419.         !verbose ${_FILEFUNC_VERBOSE}
  2420.         !undef _FILEFUNC_UN
  2421.         !define _FILEFUNC_UN `un.`
  2422.         !undef _FILEFUNC_S
  2423.         !define _FILEFUNC_S `S`
  2424.  
  2425.         !insertmacro GetOptions
  2426.  
  2427.         !undef _FILEFUNC_UN
  2428.         !define _FILEFUNC_UN
  2429.         !undef _FILEFUNC_S
  2430.         !define _FILEFUNC_S
  2431.         !verbose pop
  2432.     !endif
  2433. !macroend
  2434.  
  2435. !endif
  2436.